<template>
  <a-modal v-model:visible="visible" :confirm-loading="confirmLoading" :maskClosable='false' :footer="null" width='80%' @cancel='cancel' dialogClass='height'>
    <a-tabs>
      <a-tab-pane key="0" tab="超级签应用" force-render>
        <SuperChildren />
      </a-tab-pane>
      <a-tab-pane key="1" tab="苹果分发应用" force-render>
        <IpaChildren />
      </a-tab-pane>
      <a-tab-pane key="2" tab="安卓分发应用" force-render>
        <ApkChildren />
      </a-tab-pane>
      <a-tab-pane key="3" tab="免签分发应用" force-render v-if="userdata.rolename== Role.超级管理员||userdata.rolename== Role.高级用户">
        <MiaoChildren />
      </a-tab-pane>
      <a-tab-pane key="4" tab="开发账号管理" force-render v-if="userdata.rolename== Role.超级管理员||userdata.rolename== Role.高级用户">
        <CerChildren />
      </a-tab-pane>
      <a-tab-pane key="5" tab="用户模块管理" force-render v-if="userdata.rolename== Role.超级管理员">
        <UserChildren />
      </a-tab-pane>
      <a-tab-pane key="6" tab="域名配置" force-render v-if="userdata.rolename== Role.超级管理员">
        <DnsChildren />
      </a-tab-pane>
    </a-tabs>
  </a-modal>
</template>

<script lang='ts'>
import { reactive, SetupContext, toRefs } from "vue";
import SuperChildren from "./children/SuperChildren.vue";
import IpaChildren from "./children/IpaChildren.vue";
import MiaoChildren from "./children/miaoChildren.vue";
import ApkChildren from "./children/ApkChildren.vue";
import CerChildren from "./children/CerChildren.vue";
import UserChildren from "./children/UserChildren.vue";
import DnsChildren from "./children/DnsChildren.vue";
import createStore from "@/store/index";
import { Role } from "@/api/userApi";
export default {
  name: " ",
  components: {
    SuperChildren,
    IpaChildren,
    ApkChildren,
    CerChildren,
    UserChildren,
    DnsChildren,
    MiaoChildren,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
  },
  emits: ["onCancel"],
  setup(props: any, ctx: SetupContext) {
    const data = reactive({
      confirmLoading: false,
      userdata: createStore.state.userDataList,
    });

    /* 关闭事件 */
    function cancel(e: any) {
      ctx.emit("onCancel", false);
    }

    return {
      ...toRefs(data),
      cancel,
      Role,
    };
  },
};
</script>
<style lang="less" >
.height {
  height: 86%;
  .ant-modal-content {
    height: 100%;
  }
}
</style>